/**
 * 
 */
package com.adkfp.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.adkfp.bean.ADKActimeBean;
import com.adkfp.bean.ADKControllerBean;
import com.adkfp.bean.ADKPowerGroupBean;
import com.adkfp.bean.ADKPowerGroupDoorBean;
import com.adkfp.service.IADKActimeService;
import com.adkfp.service.IADKPowerGroupDoorService;
import com.adkfp.utils.LayuiUtil;

import net.sf.json.JSONArray;

/**
 * @author qwertyuiop
 *
 */
@Controller
@RequestMapping("aDKPowerGroupDoor")
public class ADKPowerGroupDoorAction {
	@Resource(name="aDKPowerGroupDoorService")
	private IADKPowerGroupDoorService aDKPowerGroupDoorService;
	@Resource(name="aDKActimeService")
	private IADKActimeService aDKActimeService;
	
	//增加
	@RequestMapping("insertPowerGroupDoor")
	@ResponseBody
	public void insertPowerGroupDoor(ADKPowerGroupDoorBean pgroupdoor) {
		System.err.println("----进入powergroup方法1----");
		//aDKPowerGroupDoorService.insert(netgroup);
		
	}
	
	//查询所有记录 修改了查询count 的 SQL语句 @C
		@RequestMapping("selectAlldoor")
		@ResponseBody
		public Object selectAlldoor(ADKPowerGroupDoorBean bean,HttpServletRequest request,String groupID ) {
			System.out.println("----查询----权限组中的门权限的groupID是----"+groupID);
			List<ADKPowerGroupDoorBean> list = new ArrayList<>();
			bean.setGroupID(Integer.parseInt(groupID));
			list = aDKPowerGroupDoorService.findByCondition(bean);
			long count = aDKPowerGroupDoorService.findByConditionCount(bean);
			return LayuiUtil.data(count, list);
		}

		//删除门权限
		@RequestMapping("deleteDoorPG")
		@ResponseBody
		public void deleteDoorPG(String autoID) {
			 System.out.println("删除功能中 删除门权限  autoID是------"+autoID);
			 aDKPowerGroupDoorService.delete(Integer.parseInt(autoID));
		}
		
	//修改通行时间组
		@RequestMapping("updateByautoID")
		@ResponseBody
		public void updateByautoID(HttpServletRequest request, String autoID,String doorTimeItemID,ADKPowerGroupDoorBean pGdoor ) {
			System.err.println("修改通行时间组de AutoID是"+autoID);
			System.err.println("修改通行时间组de doorTimeItemID是"+doorTimeItemID);
			pGdoor.setAutoID(Integer.parseInt(autoID));
			pGdoor.setDoorTimeItemID(Integer.parseInt(doorTimeItemID));
			aDKPowerGroupDoorService.update(pGdoor);

		}
		
}
